#define GREY_OFFSET 8
#define overlay_color(i) ((i)<<9)
#define select_overlay() writemask(7<<9) /* only write into overlay bits */
#define unselect_overlay() writemask(511)

/* make 512 > 512+7 be opaque overlays */
#define overlay_map()\
{\
  unsigned short i, j, lo;\
  short r, g, b;\
  for (i = 0; i < 512; ++i)\
    for(j = 1; j < GREY_OFFSET; ++j) {\
      getmcolor(j, &r, &g, &b);	/* their standard mapcolor */\
      /* copy color into i + shifted bits */\
      mapcolor(i | overlay_color(j), r, g, b);\
    }\
}\
